import React, {Component} from 'react';
import './ChatRoom.css';

class ChatRoom extends Component{
    constructor (props) {
        super(props)
        this.state = {
            date: new Date(),
        }
    }
    componentDidMount() {
        this.timer = setInterval(() =>{
            this.setState({
                date: new Date()
            })
        }, 1000)
    }
    componentDidUpdate(currentProps,state) {
    }
    componentWillUnmount () {
        clearInterval(this.timer)
    }
    render () {
        return (
            <div className="ss">
                <h1>{this.state.date.toLocaleTimeString()}</h1>
            </div>
        )
    }
}

export default ChatRoom
